package com.whw.fy.controller;

import com.whw.fy.entity.AreaType;
import com.whw.fy.entity.Message;
import com.whw.fy.service.AreaTypeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@Api(tags = "领域类型模块")
@RestController
@RequestMapping("/api/areaType")
public class AreaTypeController {
    @Resource
    private AreaTypeService areaTypeService;

    @ApiOperation(value = "添加领域类型信息")
    @PostMapping("/one")
    public Message insert(AreaType areaType) {
        return areaTypeService.insertSelective(areaType);
    }

    @ApiOperation(value = "删除领域类型")
    @DeleteMapping("/")
    public Message delete(Integer areaTypeId) {
        return areaTypeService.deleteByPrimaryKey(areaTypeId);
    }

    @ApiOperation(value = "修改领域类型")
    @PutMapping("/")
    public Message update(AreaType areaType) {
        return areaTypeService.updateByPrimaryKeySelective(areaType);
    }

    @ApiOperation(value = "根据领域类型id获取领域类型")
    @GetMapping("/one")
    public Message selectByPrimaryKey(Integer areaTypeId){
        return areaTypeService.selectByPrimaryKey(areaTypeId); }

    @ApiOperation(value = "获取所有领域类型")
    @GetMapping("/all")
    public Message selectAll(){
        return areaTypeService.selectAll();
    }
}
